﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Domain.Interface;
using Domain.Model;
using Newtonsoft.Json;

namespace WebAPI.Controllers
{
    public class AdminController : ApiController
    {
        public IAdmin _IAdmin { set; get; }
        // GET api/<controller>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void UpdateMyKaoHeBiaoWithMoBan()
        {
            _IAdmin.UpdateMyKaoHeBiaoWithGongZuoJiHua();

        }
        [HttpGet,HttpPost]
        public dynamic ClickMyKaoHeBiaoFenZhi()
        {
            int total;
            var str = _IAdmin.ClickMyKaoHeBiaoOverflow();
            var lst = JsonConvert.DeserializeObject<List<Domain_JiaoZhiGong>>(str);
            dynamic obj = new { data = lst, total = 0 };
            return obj;
        }

        [HttpGet, HttpPost]
        public void RejectGZJHByusername(string username)
        {
            _IAdmin.RejectGZJHByusername(username);
        }
    }
}